package com.atldy.redis.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <h2> TODO </h2>
 *
 * @Author: li-dong-yang
 * @CreateTime: 2021-11-11 23:04
 */
@RestController
@RequestMapping("/uv")
@Api(value = "天猫亿计流量基数（UV去除统计）统计", tags = "天猫亿计流量基数统计")
public class HyperloglogController {

    @Autowired
    private RedisTemplate redisTemplate;

    @ApiOperation(value = "天猫亿计流量基数统计", notes = "天猫亿计流量基数统计")
    @GetMapping("/countUv")
    public Long countUv() {
        return redisTemplate.opsForHyperLogLog().size("all");
    }

}